#!/usr/bin/env ruby

require 'pathname'
require 'getoptlong'

meUnresolved=Pathname.new($0)
me=meUnresolved.realpath
bindir=me.dirname.realpath
$homedir=bindir.parent
$libdir=$homedir+"lib"

$dollarZero=$0

require ($libdir+"fijiconfig.rb")
require ($libdir+"testlib.rb")

opts=GetoptLong.new([ '--help', GetoptLong::NO_ARGUMENT ],
                    [ '--all', GetoptLong::NO_ARGUMENT ],
                    [ '--input', GetoptLong::REQUIRED_ARGUMENT ])

def help
  puts "summarize -- summarize result of tests"
  puts
  puts "--input <file>           change input file"
  puts "--all                    print results for all tests (even success)"
  puts "--help                   display this message"
end

$input="tester-output.conf"
$all=false

opts.each {
  | opt, arg |
  case opt
  when '--help'
    help
    exit 0
  when '--all'
    $all=true
  when '--input'
    $input=arg
  end
}

unless summarize($input,$all)
  exit 1
end

